<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="http://stripes.sourceforge.net/stripes.tld" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>

<s:useActionBean beanclass="cz.muni.fi.pa165.ddtroops.web.actionbeans.SkillActionBean" var="actionBean"/>
<div class="txt">
    <h2><s:label for="skill.list"/></h2>
</div>
<c:if test="${not empty pageContext.request.getParameter('error')}">
    <div class="error">
        <b><s:label for="error.${pageContext.request.getParameter('error')}"/></b>
    </div>
</c:if>
<c:if test="${pageContext.request.isUserInRole('ROLE_SUPERVISOR')}">
    <div class="raceForm">
        <tiles:insertDefinition name="dd-troops-web.skills-createForm" />
    </div>
</c:if>
<c:forEach items="${actionBean.getProffessions()}" var="prof">
    <p class="skillProfName"><c:out value="${prof}"/></p>
    <ul class="raceList">
    <c:forEach items="${actionBean.getSkillsOfProffession(prof)}" var="skill">
        <li class="raceThumbnail">
            <p class="skillName"><c:out value="${skill.name}"/></p>
            <div class="raceBonuses">
                <s:label for="skill.name"/>:&nbsp;<c:out value="${skill.name}"/><br/>
                <s:label for="skill.description"/>:&nbsp;<c:out value="${skill.description}"/><br/>
                <s:label for="skill.profession"/>:&nbsp;<c:out value="${skill.profession}"/><br/>
                <s:label for="skill.minXP"/>:&nbsp;<c:out value="${skill.minXP}"/><br/>
            </div>
            <c:if test="${pageContext.request.isUserInRole('ROLE_SUPERVISOR')}">
                <div class="raceLinks">
                    <s:link beanclass="cz.muni.fi.pa165.ddtroops.web.actionbeans.SkillActionBean" event="delete"  class="delete">
                        <s:param name="skill.getId()" value="${skill.getId()}"/>
                        <img src="<%=request.getContextPath()%>/images/deleteIcon.gif"/>
                    </s:link>
                    <br/>
                    <s:link beanclass="cz.muni.fi.pa165.ddtroops.web.actionbeans.SkillActionBean" event="edit">
                        <s:param name="skill.getId()" value="${skill.getId()}"/>
                        <img src="<%=request.getContextPath()%>/images/editIcon.png"/>
                    </s:link>
                </div>
            </c:if>
        </li>
    </c:forEach>
    </ul>
</c:forEach>
